package com.jiaai.web.zfp_back.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.util.RestResultGenerator;
import com.jiaai.version.api.TVersionApi;
import com.jiaai.version.model.TVersionVO;
import com.jiaai.version.model.VersionVo;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * class_name:ZBVersionController
 * describe:TODO
 * create_user:张昉平
 * create_date:2017/12/20
 * create_date:14:04
 */
@RestController
@RequestMapping("/api/v1/admin/version")
public class ZBVersionController {

    @Reference
    private TVersionApi tVersionApi;

    @PostMapping("/addVersion")
    public Object addOrUpBanner(@RequestBody TVersionVO tVersionVO)throws Exception{
        tVersionVO.setTime(new Date());
        return RestResultGenerator.genSuccessResult(tVersionApi.addVersion(tVersionVO));
    }

    @GetMapping("/selectVersion/{curr}")
    public Object selectVersion(@PathVariable("curr") Integer curr, VersionVo versionVo)throws Exception{
        return RestResultGenerator.genSuccessResult(tVersionApi.selectVersion(curr,versionVo));
    }
}
